<!-- HTML header for doxygen 1.8.6-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<title>OpenCV: Information Flow Alpha Matting</title>
<link href="../../opencv.ico" rel="shortcut icon" type="image/x-icon" />
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<script type="text/javascript" src="../../tutorial-utils.js"></script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/searchdata.js"></script>
<script type="text/javascript" src="../../search/search.js"></script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
//<![CDATA[
MathJax.Hub.Config(
{
  TeX: {
      Macros: {
          matTT: [ "\\[ \\left|\\begin{array}{ccc} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \\end{array}\\right| \\]", 9],
          fork: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ \\end{array} \\right.", 4],
          forkthree: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ #5 & \\mbox{#6}\\\\ \\end{array} \\right.", 6],
          forkfour: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ #5 & \\mbox{#6}\\\\ #7 & \\mbox{#8}\\\\ \\end{array} \\right.", 8],
          vecthree: ["\\begin{bmatrix} #1\\\\ #2\\\\ #3 \\end{bmatrix}", 3],
          vecthreethree: ["\\begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \\end{bmatrix}", 9],
          cameramatrix: ["#1 = \\begin{bmatrix} f_x & 0 & c_x\\\\ 0 & f_y & c_y\\\\ 0 & 0 & 1 \\end{bmatrix}", 1],
          distcoeffs: ["(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6 [, s_1, s_2, s_3, s_4[, \\tau_x, \\tau_y]]]]) \\text{ of 4, 5, 8, 12 or 14 elements}"],
          distcoeffsfisheye: ["(k_1, k_2, k_3, k_4)"],
          hdotsfor: ["\\dots", 1],
          mathbbm: ["\\mathbb{#1}", 1],
          bordermatrix: ["\\matrix{#1}", 1]
      }
  }
}
);
//]]>
</script><script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js"></script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
<link href="../../stylesheet.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<!--#include virtual="/google-search.html"-->
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="../../opencv-logo-small.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">OpenCV
   &#160;<span id="projectnumber">4.5.2</span>
   </div>
   <div id="projectbrief">Open Source Computer Vision</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
</script>
<script type="text/javascript" src="../../menudata.js"></script>
<script type="text/javascript" src="../../menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('../../',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="../../d3/d81/tutorial_contrib_root.html">Tutorials for contrib modules</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">Information Flow Alpha Matting </div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>This project was part of Google Summer of Code 2019.</p>
<p><em>Student:</em> Muskaan Kularia</p>
<p><em>Mentor:</em> Sunita Nayak</p>
<p>Alphamatting is the problem of extracting the foreground with soft boundaries from a background image. The extracted foreground can be used for further operations like changing the background in an image.</p>
<p>Given an input image and its corresponding trimap, we try to extract the foreground from the background. Following is an example:</p>
<p>Input Image: </p><div class="image">
<img src="../../plant.jpg" alt="plant.jpg"/>
</div>
<p> Input image should be preferably a RGB image.</p>
<p>Input Trimap: </p><div class="image">
<img src="../../plant.png" alt="plant.png"/>
</div>
<p> The trimap image is a greyscale image that contains information about the foreground(white pixels), background(black pixels) and unknown(grey) pixels.</p>
<p>Output alpha Matte: </p><div class="image">
<img src="../../plant_result.png" alt="plant_result.png"/>
</div>
<p> The computed alpha matte is saved as a greyscale image where the pixel values indicate the opacity of the extracted foreground object. These opacity values can be used to blend the foreground object into a diffferent backgound, as shown below: </p><div class="image">
<img src="../../plant_new_backgrounds.jpg" alt="plant_new_backgrounds.jpg"/>
</div>
<p>Following are some more results. </p><div class="image">
<img src="../../matting_results.jpg" alt="matting_results.jpg"/>
</div>
<p>The first column is input RGB image, the second column is input trimap, third column is the extracted alpha matte and the last two columns show the foreground object blended on new backgrounds.</p>
<p>This project is implementation of <a class="el" href="../../d0/de3/citelist.html#CITEREF_aksoy2017designing">[7]</a> . It also required implementation of parts of other papers [2,3,4].</p>
<h1>Building</h1>
<p>This module uses the Eigen package.</p>
<p>Build the sample code of the alphamat module using the following two cmake commands run inside the build folder: </p><div class="fragment"><div class="line">cmake -DOPENCV_EXTRA_MODULES_PATH=&lt;path to opencv_contrib modules&gt; -DBUILD_EXAMPLES=ON ..</div><div class="line"></div><div class="line">cmake --build . --config Release --target example_alphamat_information_flow_matting</div></div><!-- fragment --><p> Please refer to OpenCV building tutorials for further details, if needed.</p>
<h1>Testing</h1>
<p>The built target can be tested as follows: </p><div class="fragment"><div class="line">&lt;path to your opencv build directory&gt;/bin/example_alphamat_information_flow_matting -img=&lt;path to input image file&gt; -tri=&lt;path to the corresponding trimap&gt; -out=&lt;path to save output matte file&gt;</div></div><!-- fragment --> <h1>Source Code of the sample</h1>
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">// This file is part of OpenCV project.</span></div><div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment">// It is subject to the license terms in the LICENSE file found in the top-level directory</span></div><div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment">// of this distribution and at http://opencv.org/license.html.</span></div><div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;</div><div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment">// Include relevant headers</span></div><div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="preprocessor">#include &lt;iostream&gt;</span></div><div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="../../d4/dd5/highgui_8hpp.html">opencv2/highgui.hpp</a>&quot;</span></div><div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="../../d0/d9c/core_2include_2opencv2_2core_8hpp.html">opencv2/core.hpp</a>&gt;</span></div><div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="../../d1/d4f/imgproc_2include_2opencv2_2imgproc_8hpp.html">opencv2/imgproc.hpp</a>&gt;</span></div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="../../d7/da5/alphamat_8hpp.html">opencv2/alphamat.hpp</a>&gt;</span></div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;</div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="comment">// Set namespaces</span></div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="keyword">using namespace </span>std;</div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="keyword">using namespace </span><a class="code" href="../../d2/d75/namespacecv.html">cv</a>;</div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="keyword">using namespace </span><a class="code" href="../../d8/de8/namespacecv_1_1alphamat.html">cv::alphamat</a>;</div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;</div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="comment">// Set the usage parameter names</span></div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="keyword">const</span> <span class="keywordtype">char</span>* keys =</div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;    <span class="stringliteral">&quot;{img || input image name}&quot;</span></div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;    <span class="stringliteral">&quot;{tri || input trimap image name}&quot;</span></div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;    <span class="stringliteral">&quot;{out || output image name}&quot;</span></div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;    <span class="stringliteral">&quot;{help h || print help message}&quot;</span></div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;;</div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;</div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="keywordtype">int</span> main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span>* argv[])</div><div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;{</div><div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;    <a class="code" href="../../d0/d2e/classcv_1_1CommandLineParser.html">CommandLineParser</a> parser(argc, argv, keys);</div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;    parser.about(<span class="stringliteral">&quot;This sample demonstrates Information Flow Alpha Matting&quot;</span>);</div><div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;</div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;    <span class="keywordflow">if</span> (parser.has(<span class="stringliteral">&quot;help&quot;</span>))</div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;    {</div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;        parser.printMessage();</div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;        <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;    }</div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;</div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;    <span class="comment">// Read the paths to the input image, input trimap and the location of the output image.</span></div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;    <span class="keywordtype">string</span> img_path = parser.get&lt;std::string&gt;(<span class="stringliteral">&quot;img&quot;</span>);</div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;    <span class="keywordtype">string</span> trimap_path = parser.get&lt;std::string&gt;(<span class="stringliteral">&quot;tri&quot;</span>);</div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;    <span class="keywordtype">string</span> result_path = parser.get&lt;std::string&gt;(<span class="stringliteral">&quot;out&quot;</span>);</div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;</div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;    <span class="comment">// Make sure the user inputs paths to the input image and trimap</span></div><div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;    <span class="keywordflow">if</span> (!parser.check()</div><div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;            || img_path.empty() || trimap_path.empty())</div><div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;    {</div><div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;        parser.printMessage();</div><div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;        parser.printErrors();</div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;        <span class="keywordflow">return</span> 1;</div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;    }</div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;</div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;    <a class="code" href="../../d3/d63/classcv_1_1Mat.html">Mat</a> image, tmap;</div><div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;</div><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;    <span class="comment">// Read the input image</span></div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;    image = <a class="code" href="../../d4/da8/group__imgcodecs.html#ga288b8b3da0892bd651fce07b3bbd3a56">imread</a>(img_path, <a class="code" href="../../d8/d6a/group__imgcodecs__flags.html#gga61d9b0126a3e57d9277ac48327799c80af660544735200cbe942eea09232eb822">IMREAD_COLOR</a>);</div><div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;    <span class="keywordflow">if</span> (image.<a class="code" href="../../d3/d63/classcv_1_1Mat.html#abbec3525a852e77998aba034813fded4">empty</a>())</div><div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;    {</div><div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;        printf(<span class="stringliteral">&quot;Cannot read image file: &#39;%s&#39;\n&quot;</span>, img_path.c_str());</div><div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;        <span class="keywordflow">return</span> 1;</div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;    }</div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;</div><div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;    <span class="comment">// Read the trimap</span></div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;    tmap = <a class="code" href="../../d4/da8/group__imgcodecs.html#ga288b8b3da0892bd651fce07b3bbd3a56">imread</a>(trimap_path, <a class="code" href="../../d8/d6a/group__imgcodecs__flags.html#gga61d9b0126a3e57d9277ac48327799c80ae29981cfc153d3b0cef5c0daeedd2125">IMREAD_GRAYSCALE</a>);</div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;    <span class="keywordflow">if</span> (tmap.<a class="code" href="../../d3/d63/classcv_1_1Mat.html#abbec3525a852e77998aba034813fded4">empty</a>())</div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;    {</div><div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;        printf(<span class="stringliteral">&quot;Cannot read trimap file: &#39;%s&#39;\n&quot;</span>, trimap_path.c_str());</div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;        <span class="keywordflow">return</span> 1;</div><div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;    }</div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;</div><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;    <a class="code" href="../../d3/d63/classcv_1_1Mat.html">Mat</a> result;</div><div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;    <span class="comment">// Perform information flow alpha matting</span></div><div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;    <a class="code" href="../../d4/d40/group__alphamat.html#gad599f98a151eda56ab241b296aec4810">infoFlow</a>(image, tmap, result);</div><div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;</div><div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;    <span class="keywordflow">if</span> (result_path.empty())</div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;    {</div><div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;        <span class="comment">// Show the alpha matte if a result filepath is not provided.</span></div><div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;        <a class="code" href="../../d7/dfc/group__highgui.html#ga5afdf8410934fd099df85c75b2e0888b">namedWindow</a>(<span class="stringliteral">&quot;result alpha matte&quot;</span>, <a class="code" href="../../d0/d90/group__highgui__window__flags.html#ggabf7d2c5625bc59ac130287f925557ac3a29e45c5af696f73ce5e153601e5ca0f1">WINDOW_NORMAL</a>);</div><div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;        <a class="code" href="../../d7/dfc/group__highgui.html#ga453d42fe4cb60e5723281a89973ee563">imshow</a>(<span class="stringliteral">&quot;result alpha matte&quot;</span>, result);</div><div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;        <a class="code" href="../../d7/dfc/group__highgui.html#ga5628525ad33f52eab17feebcfba38bd7">waitKey</a>(0);</div><div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;    }</div><div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;    <span class="keywordflow">else</span></div><div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;    {</div><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;        <span class="comment">// Save the alphamatte</span></div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;        <a class="code" href="../../d4/da8/group__imgcodecs.html#gabbc7ef1aa2edfaa87772f1202d67e0ce">imwrite</a>(result_path, result);</div><div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;        printf(<span class="stringliteral">&quot;Result saved: &#39;%s&#39;\n&quot;</span>, result_path.c_str());</div><div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;    }</div><div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;</div><div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;    <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;}</div><div class="ttc" id="group__imgcodecs_html_gabbc7ef1aa2edfaa87772f1202d67e0ce"><div class="ttname"><a href="../../d4/da8/group__imgcodecs.html#gabbc7ef1aa2edfaa87772f1202d67e0ce">cv::imwrite</a></div><div class="ttdeci">bool imwrite(const String &amp;filename, InputArray img, const std::vector&lt; int &gt; &amp;params=std::vector&lt; int &gt;())</div><div class="ttdoc">Saves an image to a specified file. </div></div>
<div class="ttc" id="group__imgcodecs_html_ga288b8b3da0892bd651fce07b3bbd3a56"><div class="ttname"><a href="../../d4/da8/group__imgcodecs.html#ga288b8b3da0892bd651fce07b3bbd3a56">cv::imread</a></div><div class="ttdeci">Mat imread(const String &amp;filename, int flags=IMREAD_COLOR)</div><div class="ttdoc">Loads an image from a file. </div></div>
<div class="ttc" id="highgui_8hpp_html"><div class="ttname"><a href="../../d4/dd5/highgui_8hpp.html">highgui.hpp</a></div></div>
<div class="ttc" id="group__highgui_html_ga453d42fe4cb60e5723281a89973ee563"><div class="ttname"><a href="../../d7/dfc/group__highgui.html#ga453d42fe4cb60e5723281a89973ee563">cv::imshow</a></div><div class="ttdeci">void imshow(const String &amp;winname, InputArray mat)</div><div class="ttdoc">Displays an image in the specified window. </div></div>
<div class="ttc" id="alphamat_8hpp_html"><div class="ttname"><a href="../../d7/da5/alphamat_8hpp.html">alphamat.hpp</a></div></div>
<div class="ttc" id="namespacecv_html"><div class="ttname"><a href="../../d2/d75/namespacecv.html">cv</a></div><div class="ttdoc">&quot;black box&quot; representation of the file storage associated with a file on disk. </div><div class="ttdef"><b>Definition:</b> affine.hpp:51</div></div>
<div class="ttc" id="classcv_1_1CommandLineParser_html"><div class="ttname"><a href="../../d0/d2e/classcv_1_1CommandLineParser.html">cv::CommandLineParser</a></div><div class="ttdoc">Designed for command line parsing. </div><div class="ttdef"><b>Definition:</b> utility.hpp:799</div></div>
<div class="ttc" id="group__imgcodecs__flags_html_gga61d9b0126a3e57d9277ac48327799c80af660544735200cbe942eea09232eb822"><div class="ttname"><a href="../../d8/d6a/group__imgcodecs__flags.html#gga61d9b0126a3e57d9277ac48327799c80af660544735200cbe942eea09232eb822">cv::IMREAD_COLOR</a></div><div class="ttdoc">If set, always convert image to the 3 channel BGR color image. </div><div class="ttdef"><b>Definition:</b> imgcodecs.hpp:72</div></div>
<div class="ttc" id="group__imgcodecs__flags_html_gga61d9b0126a3e57d9277ac48327799c80ae29981cfc153d3b0cef5c0daeedd2125"><div class="ttname"><a href="../../d8/d6a/group__imgcodecs__flags.html#gga61d9b0126a3e57d9277ac48327799c80ae29981cfc153d3b0cef5c0daeedd2125">cv::IMREAD_GRAYSCALE</a></div><div class="ttdoc">If set, always convert image to the single channel grayscale image (codec internal conversion)...</div><div class="ttdef"><b>Definition:</b> imgcodecs.hpp:71</div></div>
<div class="ttc" id="group__highgui_html_ga5afdf8410934fd099df85c75b2e0888b"><div class="ttname"><a href="../../d7/dfc/group__highgui.html#ga5afdf8410934fd099df85c75b2e0888b">cv::namedWindow</a></div><div class="ttdeci">void namedWindow(const String &amp;winname, int flags=WINDOW_AUTOSIZE)</div><div class="ttdoc">Creates a window. </div></div>
<div class="ttc" id="core_2include_2opencv2_2core_8hpp_html"><div class="ttname"><a href="../../d0/d9c/core_2include_2opencv2_2core_8hpp.html">core.hpp</a></div></div>
<div class="ttc" id="group__alphamat_html_gad599f98a151eda56ab241b296aec4810"><div class="ttname"><a href="../../d4/d40/group__alphamat.html#gad599f98a151eda56ab241b296aec4810">cv::alphamat::infoFlow</a></div><div class="ttdeci">void infoFlow(InputArray image, InputArray tmap, OutputArray result)</div><div class="ttdoc">Compute alpha matte of an object in an image. </div></div>
<div class="ttc" id="namespacecv_1_1alphamat_html"><div class="ttname"><a href="../../d8/de8/namespacecv_1_1alphamat.html">cv::alphamat</a></div><div class="ttdef"><b>Definition:</b> alphamat.hpp:23</div></div>
<div class="ttc" id="imgproc_2include_2opencv2_2imgproc_8hpp_html"><div class="ttname"><a href="../../d1/d4f/imgproc_2include_2opencv2_2imgproc_8hpp.html">imgproc.hpp</a></div></div>
<div class="ttc" id="group__highgui__window__flags_html_ggabf7d2c5625bc59ac130287f925557ac3a29e45c5af696f73ce5e153601e5ca0f1"><div class="ttname"><a href="../../d0/d90/group__highgui__window__flags.html#ggabf7d2c5625bc59ac130287f925557ac3a29e45c5af696f73ce5e153601e5ca0f1">cv::WINDOW_NORMAL</a></div><div class="ttdoc">the user can resize the window (no constraint) / also use to switch a fullscreen window to a normal s...</div><div class="ttdef"><b>Definition:</b> highgui.hpp:187</div></div>
<div class="ttc" id="classcv_1_1Mat_html"><div class="ttname"><a href="../../d3/d63/classcv_1_1Mat.html">cv::Mat</a></div><div class="ttdoc">n-dimensional dense array class </div><div class="ttdef"><b>Definition:</b> mat.hpp:801</div></div>
<div class="ttc" id="classcv_1_1Mat_html_abbec3525a852e77998aba034813fded4"><div class="ttname"><a href="../../d3/d63/classcv_1_1Mat.html#abbec3525a852e77998aba034813fded4">cv::Mat::empty</a></div><div class="ttdeci">bool empty() const</div><div class="ttdoc">Returns true if the array has no elements. </div></div>
<div class="ttc" id="group__highgui_html_ga5628525ad33f52eab17feebcfba38bd7"><div class="ttname"><a href="../../d7/dfc/group__highgui.html#ga5628525ad33f52eab17feebcfba38bd7">cv::waitKey</a></div><div class="ttdeci">int waitKey(int delay=0)</div><div class="ttdoc">Waits for a pressed key. </div></div>
</div><!-- fragment --><h1>References</h1>
<p>[1] Yagiz Aksoy, Tunc Ozan Aydin, Marc Pollefeys, <a href="https://www.researchgate.net/publication/318489370_Designing_Effective_Inter-Pixel_Information_Flow_for_Natural_Image_Matting">Designing Effective Inter-Pixel Information Flow for Natural Image Matting</a>, CVPR, 2017.</p>
<p>[2] Roweis, Sam T., and Lawrence K. Saul. <a href="https://science.sciencemag.org/content/290/5500/2323">Nonlinear dimensionality reduction by locally linear embedding</a>, Science 290.5500 (2000): 2323-2326.</p>
<p>[3] Anat Levin, Dani Lischinski, Yair Weiss, <a href="https://www.researchgate.net/publication/5764820_A_Closed-Form_Solution_to_Natural_Image_Matting">A Closed Form Solution to Natural Image Matting</a>, IEEE TPAMI, 2008.</p>
<p>[4] Qifeng Chen, Dingzeyu Li, Chi-Keung Tang, <a href="http://dingzeyu.li/files/knn-matting-tpami.pdf">KNN Matting</a>, IEEE TPAMI, 2013.</p>
<p>[5] Yagiz Aksoy, <a href="https://github.com/yaksoy/AffinityBasedMattingToolbox">Affinity Based Matting Toolbox</a>. </p>
</div></div><!-- contents -->
<!-- HTML footer for doxygen 1.8.6-->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri Apr 2 2021 11:36:38 for OpenCV by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="../../doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
<script type="text/javascript">
//<![CDATA[
addTutorialsButtons();
//]]>
</script>
</body>
</html>
